package com.yequan.hbb.adapter;



import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.yequan.hbb.view.fragment.hbc_fragment.ConcernFragment;
import com.yequan.hbb.view.fragment.hbc_fragment.HottestFragment;
import com.yequan.hbb.view.fragment.hbc_fragment.RecentFragment;

/**
 * Created by gwf on 2016/10/14.
 */

public class UpDateAdapter extends FragmentPagerAdapter {
    private String[] titles;

    public UpDateAdapter(FragmentManager fm) {
        super(fm);
        titles = new String[]{"最新", "最热", "关注"};
    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        switch (position) {
            case 0:
                fragment = new RecentFragment();
                break;
            case 1:
                fragment = new HottestFragment();
                break;
            case 2:
                fragment = new ConcernFragment();
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return titles.length;
    }
    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
